class Student(object):

    @property
    def score(self):
        return self._score

    @score.setter
    def score(self, value):
        if not isinstance(value, int):
            raise ValueError('score must be an integer!')
        if value < 0 or value > 100:
            raise ValueError('score must between 0 ~ 100!')
        self._score = value

#s.score = 60
#print('s.score =', s.score)
# ValueError: score must between 0 ~ 100!
#s.score = 9999
#

class Screen(object):

    @property
    def width(self):
        return self._width

    @width.setter
    def width(self, width):
        if isinstance(width, int) and width > 0:
            self._width = width
        else:
            print('Width is illegal')

    @property
    def height(self):
        return self._height

    @height.setter
    def height(self, height):
        if isinstance(height, int) and height > 0:
            self._height = height
        else:
            print('Height is illegal')

    @property
    def resolution(self):
        if hasattr(self, '_width') and hasattr(self, '_height'):
            return self._height * self._width
        else:
            print('Please define all attributes')

# test:
s = Screen()
s.width = 1024
s.height = 768
print(s.resolution)
assert s.resolution == 786432, '1024 * 768 = %d ?' % s.resolution

        